package com.example.exam.service.impl;

import com.example.exam.entity.Question;
import com.example.exam.repository.QuestionRepository;
import com.example.exam.service.QuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

/**
 * @author shishuqian
 * date 2021/5/5
 * time 17:59
 **/
@Service
public class QuestionServiceImpl implements QuestionService {

    @Autowired
    private QuestionRepository questionRepository;

    @Override
    public Question findById(Integer id) {
        Optional<Question> question = questionRepository.findById(id);
        return question.orElse(null);
    }
}
